/**
 * [orderFilterParam description]
 * @type {Object}
 */
var storeListSelectOneFilterParam = {
    shopId:'',
    shopName:''
};
(function(doc, win) {

    // sui 页面就绪时间
    $(doc).on("pageInit", "#storeListSelectOneFilterPage", function(e, pageId, $page, isBack) { 
        if (orderFilterParam.cache) {
            $('#storeListSelectOneFilterPage .page-body .no-data-wrap').hide();
        } else {
            $('#storeListSelectOneFilterPage .page-body .no-data-wrap').show();
        }    
        CommonUtil.render($("#selectOrderShopDiv"), "selectOrderShopTpl", {data: orderFilterParam.cache});
        $('#storeListSelectOneFilterPage .page-body #selectOrderShopDiv .store-list li').each(function(){
            var shopId = $(this).attr("shopId");
            if (shopId && shopId == orderFilterParam.params.shopId) {
                $(this).addClass("selected");
                $('#storeListSelectOneFilterPage .scroll-view .check-all').css("color", "#333");
                return;
            } 
        });
        //清空本页存储的数据
        if(orderFilterParam.params.shopId == '') {
            storeListSelectOneFilterParam.shopId = '';
            storeListSelectOneFilterParam.shopName = '';
            $('#storeListSelectOneFilterPage .scroll-view .check-all').css("color", "#508cee");
        }

    });

    // 点击返回
    $(doc).on('click','#storeListSelectOneFilterPage .scroll-view .header .left',function(){
        $('#storeListSelectOneFilterPage .page-body #selectOrderShopDiv .store-list li').removeClass("selected");
    });


    // 选择某个门店
    $(doc).on('click','#storeListSelectOneFilterPage .page-body #selectOrderShopDiv .store-list li',function(){
        $('#storeListSelectOneFilterPage .page-body #selectOrderShopDiv .store-list li').removeClass("selected");
        $(this).addClass("selected");
        $('#storeListSelectOneFilterPage .scroll-view .check-all').css("color", "#333");
        storeListSelectOneFilterParam.shopId = $(this).attr("shopId");
        storeListSelectOneFilterParam.shopName = $(this).attr("shopName");
    });

    // 选择全部
    $(doc).on('click','#storeListSelectOneFilterPage .check-all',function(){
        $('#storeListSelectOneFilterPage .page-body #selectOrderShopDiv .store-list li').removeClass("selected");
        $('#storeListSelectOneFilterPage .scroll-view .check-all').css("color", "#508cee");
        storeListSelectOneFilterParam.shopId = '';
        storeListSelectOneFilterParam.shopName = '';
    });
})(document, window);

